import {
    graphql,
    GraphQLSchema,
    GraphQLObjectType,
    GraphQLString,
    GraphQLList,
    GraphQLNonNull,
    GraphQLBoolean,
    GraphQLInt

} from 'graphql';

import * as query from '../../db/query'

export let deviceallType = new GraphQLObjectType({
    name: 'deviceall',
    fields: {
        barcode: {
            type: GraphQLString
        },
        serial_number: {
            type: GraphQLString
        },
        kind_id: {
            type: GraphQLInt
        },
        brand: {
            type: GraphQLString
        },
        model: {
            type: GraphQLString
        },
        user_id: {
            type: GraphQLInt
        },
        type: {
            type: GraphQLString
        },
        state: {
            type: GraphQLString
        },
        factory_time: {
            type: GraphQLString
        },
        scrap_time: {
            type: GraphQLString
        },
        remarks: {
            type: GraphQLString
        },
        isdel: {
            type: GraphQLInt
        },
        drive: {
            type: GraphQLString
        },
        peizhi: {
            type: GraphQLString
        },
        baoxiu: {
            type: GraphQLString
        },

        user_name: {
            type: GraphQLString
        },
        user_code: {
            type: GraphQLString
        },
        company: {
            type: GraphQLString
        },
        department: {
            type: GraphQLString
        }
    }

})

export const deviceAllList = {
    type: new GraphQLList(deviceallType),
    args: {
        company: {
            type: GraphQLString
        },
        department: {
            type: GraphQLString
        }
    },
    resolve(root, params, options) {
        return query.deviceListByDepatment(params)
    }
}
